// #define print(...)

class Solution {
public:
    vector<int> findErrorNums(vector<int>& nums) {
        vector<int> repeat_lost(2);
        vector<int> bucket;
        bucket.reserve(nums.size());
        bucket.resize(nums.size());
        for(int i:nums)
            bucket[i-1]++;
        print("bucket:", bucket, "\n")
        int re = 0;
        for(auto it=bucket.begin(); re<2 && it!=bucket.end(); it++){
            if(0 == *it && ++re)
                repeat_lost[1] = int(it-bucket.begin()+1);
            else if(1 < *it && ++re)
                repeat_lost[0] = int(it-bucket.begin()+1);
        }
        return repeat_lost;
    }
};
